// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'

import ElementUI from 'element-ui'
// import 'element-ui/lib/theme-blue/index.css'
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios'
import 'babel-polyfill'

Vue.use(ElementUI)
Vue.prototype.$axios = axios;
Vue.config.productionTip = false

router.beforeEach((to, from, next) => {
	//NProgress.start();
	let croUser = JSON.parse(window.localStorage.getItem('croUser'));
	if (croUser) {
		store.state.croUser = croUser;
	}
	next();
})

// 移除数组某一项
Array.prototype.indexOf = function(val) { 
	for (var i = 0; i < this.length; i++) { 
	if (this[i] == val) return i; 
	} 
	return -1; 
};
Array.prototype.remove = function(val) { 
	var index = this.indexOf(val); 
	if (index > -1) { 
	this.splice(index, 1); 
	} 
};
/* eslint-disable no-new */
new Vue({
	el: '#app',
	router,
	store,
	components: { App },
	template: '<App/>'
})
